<?php

// require_once 'Zend/Gdata/Extension.php';
require_once dirname(__FILE__) . '/ItemParams.php';

class Rass_Extension_ItemContent extends Raws_Extension_Content
{

  // public function __construct($params = null, $type = 'application/xml', $src = null)
  // {
  //     parent::__construct();
  // }

  public function getDOM($doc = null)
  {
      $element = parent::getDOM($doc);
      if ($this->_params !== null) {
          $element->appendChild($this->_params->getDOM($element->ownerDocument));
      }
      return $element;
  }

    /**
     * Creates individual Entry objects of the appropriate type and
     * stores them as members of this entry based upon DOM data.
     *
     * @param DOMNode $child The DOMNode to process
     */
    protected function takeChildFromDOM($child)
    {
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
        
        switch ($absoluteNodeName) {
          case $this->lookupNamespace('raws') . ':' . 'params':
              $params = new Rass_Extension_ItemParams();
              $params->transferFromDOM($child);
              $this->_params = $params;
              break;
          default:
              parent::takeChildFromDOM($child);
              break;
        }
    }
    
}
